<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>
<%@page import="com.feib.soeasy.util.CodeTableUtil"%>
<%@page import="com.feib.soeasy.model.UploadFile"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><%=UserUtil.getCurrentMenuItemName() %></title>
	<script type="text/javascript">
	<!--	
	$(document).ready(function() {	
	});

	function doUploadFileConfirmAction(uploadFileStatus)
	{
		var isDoComfirm = false;
		$('#confirmHiddenFrom input:checkbox.chk').each(function(){               
        	if ( $(this).attr('checked') ){
        		isDoComfirm = true;
        	}
       	});

		if(isDoComfirm){
			$('#hidden\\.qryUploadFile\\.fileStatus').val(uploadFileStatus);
			waitingDialog({});
			
			$.ajax({url : "<c:url value='/ajax/Soez2003.action'/>",
				async : true,
				type : 'POST',
				data : $("#confirmHiddenFrom").serialize(),
				dataType : 'html',
				success : function(data, textStatus, XMLHttpRequest){
						$("#paymentListDiv").html(data);
					},
				error : function(XMLHttpRequest, textStatus, errorThrown){
					$("#ajaxErrorMessageDiv").html('系統發生錯誤，請聯絡管理員');
					$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
					$("#ajaxErrorMessageDiv" ).dialog({  
						title:'系統錯誤' 
						,width: 600
						, resizable: false
						, modal: true
						, buttons: {
							Ok: function() {
								$( this ).dialog( "close" );
							}
						}
					});
					},
				complete: function(XMLHttpRequest, textStatus){
					closeWaitingDialog();
					$("#paymentListDiv").fadeTo("hide", 1);
				}
			});
	
		}else{
			$("#ajaxErrorMessageDiv").html("至少選擇一筆");
                    $("#ajaxErrorMessageDiv" ).dialog( "destroy" );
                    $("#ajaxErrorMessageDiv" ).dialog({  
                        title:'錯誤訊息' 
                        ,width: 600
                        , resizable: false
                        , modal: true
                        , buttons: {
                            Ok: function() {
                                $( this ).dialog( "close" );
                            }
                        }
                    });
                    return false;
		}
	}
	
	function doPaymentsConfirmAction(uploadFilePk, fileStatus)
	{
		$('#hidden\\.qryUploadFile\\.uploadFilePk3').val(uploadFilePk);
		$('#hidden\\.qryUploadFile\\.fileStatus3').val(fileStatus);
		//alert(fileStatus);
		
		waitingDialog({});
		
		$.ajax({url : "<c:url value='/ajax/Soez2003.action'/>",
			async : false,
			type : 'POST',
			data : $("#confirmHiddenFrom2").serialize(),
			dataType : 'html',
			success : function(data, textStatus, XMLHttpRequest){
					$("#paymentListDiv").append(data);
				},
			error : function(XMLHttpRequest, textStatus, errorThrown){
				$("#ajaxErrorMessageDiv").html('系統發生錯誤，請聯絡管理員');
				$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
				$("#ajaxErrorMessageDiv" ).dialog({  
					title:'系統錯誤' 
					,width: 600
					, resizable: false
					, modal: true
					, buttons: {
						Ok: function() {
							$( this ).dialog( "close" );
						}
					}
				});
				},
			complete: function(XMLHttpRequest, textStatus){
				closeWaitingDialog();
			}
		});

	}
	
	function doQueryAction()
	{
		$.ajax({url : "<c:url value='/ajax/Soez2003.action'/>",
			async : true,
			type : 'POST',
			data : $("#queryListFrom").serialize(),
			dataType : 'html',
			success : function(data, textStatus, XMLHttpRequest){
					$("#paymentListDiv").html(data);
				},
			error : function(XMLHttpRequest, textStatus, errorThrown){
				$("#ajaxErrorMessageDiv").html('系統發生錯誤，請聯絡管理員');
				$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
				$("#ajaxErrorMessageDiv" ).dialog({  
					title:'系統錯誤' 
					,width: 600
					, resizable: false
					, modal: true
					, buttons: {
						Ok: function() {
							$( this ).dialog( "close" );
						}
					}
				});
				},
			complete: function(XMLHttpRequest, textStatus){
				$("#paymentListDiv").fadeTo("slow", 1);
				closeWaitingDialog();
			}
		});
	}
	
	function doQueryPaymentsAction(uploadFilePk)
	{
		$('#hidden\\.qryUploadFile\\.uploadFilePk2').val(uploadFilePk);
		
		$("#paymentGroupDiv").fadeTo("slow", 0.1);
		
		waitingDialog({});
		
		$.ajax({url : "<c:url value='/ajax/Soez2003.action'/>",
			async : true,
			type : 'POST',
			data : $("#queryHiddenFrom").serialize(),
			dataType : 'html',
			success : function(data, textStatus, XMLHttpRequest){
					$("#paymentGroupDiv").html(data);
				},
			error : function(XMLHttpRequest, textStatus, errorThrown){
				$("#ajaxErrorMessageDiv").html('系統發生錯誤，請聯絡管理員');
				$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
				$("#ajaxErrorMessageDiv" ).dialog({  
					title:'系統錯誤' 
					,width: 600
					, resizable: false
					, modal: true
					, buttons: {
						Ok: function() {
							$( this ).dialog( "close" );
						}
					}
				});
				},
			complete: function(XMLHttpRequest, textStatus){
				$("#paymentGroupDiv").fadeTo("slow", 1);
				closeWaitingDialog();
			}
		});
	}
	
	
	function doQueryFilePaymentsAction(pageNumber, filePk)
	{
		if (null != filePk)
		{
			$('#hidden\\.qryUploadFile\\.uploadFilePk').val(filePk);
		}
		$('#hidden\\.queryPaymentResult\\.pageNumber').val(pageNumber);

		waitingDialog({});
		$.ajax({url : "<c:url value='/ajax/Soez2003.action'/>",
			async : true,
			type : 'POST',
			data : $("#queryFilePaymentsHiddenFrom").serialize(),
			dataType : 'html',
			success : function(data, textStatus, XMLHttpRequest){
					$("#paymentsOfFileDiv").html(data);
				},
			error : function(XMLHttpRequest, textStatus, errorThrown){
					$("#ajaxErrorMessageDiv").html('系統發生錯誤，請聯絡管理員');
					$("#ajaxErrorMessageDiv" ).dialog( "destroy" );
					$("#ajaxErrorMessageDiv" ).dialog({  
						title:'系統錯誤' 
						,width: 600
						, resizable: false
						, modal: true
						, buttons: {
							Ok: function() {
								$( this ).dialog( "close" );
							}
						}
					});
				},
			complete: function(XMLHttpRequest, textStatus){closeWaitingDialog();}
		});
	}

	function doCheckAll(){
		$('#confirmHiddenFrom input:checkbox.chk').each(function(){              
        $(this).attr("checked", true);
       });
	}
	
	function undoCheckAll(){
		$('#confirmHiddenFrom input:checkbox.chk').each(function(){               
        $(this).attr("checked", false);
       });
	}
	
	//-->
	</script>
</head>
<body>
<div id="mainAreaCT">
		<jsp:include page="/includes/path.jsp"/>
		<jsp:include page="/includes/subMenu.jsp"/>
		

<div style="display: none;">
<stripes:form id="queryListFrom" beanclass="com.feib.soeasy.action.Soez2003ActionBean" 
			method="post" onsubmit="javascript: return false;">
			<input type="hidden" id="method1" name="doAjaxQuery"/>
</stripes:form>
</div>

<div id="paymentListDiv" style="display: none;">
</div>

<!-- 繳費總覽查詢結果  -->
<div id="paymentGroupDiv" style="display: none; height:85%; overflow:auto; overflow-x: hidden;">
</div>
	
<div id="queryPaymentHiddenFormDiv" style="display: none;">
	<stripes:form id="queryHiddenFrom" beanclass="com.feib.soeasy.action.Soez2003ActionBean" 
		method="post" onsubmit="javascript: return false;">
		<stripes:hidden id="hidden.qryUploadFile.uploadFilePk2" name="qryUploadFile.uploadFilePk"/>			
		<input type="hidden" id="method2" name="doAjaxQueryPayments"/>
	</stripes:form>
</div>

<div id="confirmPaymentHiddenFormDiv" style="display: none;">
	<stripes:form id="confirmHiddenFrom2" beanclass="com.feib.soeasy.action.Soez2003ActionBean" 
		method="post" onsubmit="javascript: return false;">
		<stripes:hidden id="hidden.qryUploadFile.uploadFilePk3" name="qryUploadFile.uploadFilePk"/>
		<stripes:hidden id="hidden.qryUploadFile.fileStatus3" name="qryUploadFile.fileStatus"/>			
		<input type="hidden" id="method3" name="doAjaxPaymentsConfirm"/>
	</stripes:form>
</div>

	<!-- 檔案放行明細查詢 -->
	<div id="paymentsOfFileDiv" style="display: none;">
	</div>
	<div id="queryFilePaymentsHiddenFormDiv" style="display: none; ">
		<stripes:form id="queryFilePaymentsHiddenFrom" beanclass="com.feib.soeasy.action.Soez2003ActionBean" 
			method="post" onsubmit="javascript: return false;">			
			<stripes:hidden id="hidden.qryUploadFile.uploadFilePk" name="qryUploadFile.uploadFilePk"/>
			<stripes:hidden id="hidden.queryPaymentResult.pageNumber" name="queryPaymentResult.pageNumber" />
			<input type="hidden" id="hidden.queryPaymentResult.pageSize" name="queryPaymentResult.pageSize" value="5"/>	
			<input type="hidden" id="method4" name="doAjaxQueryFilePayments"/>
		</stripes:form>
	</div>

	<!-- Message -->
	<div id="ajaxErrorMessageDiv" style="display: none;"></div>
	
</div>


<script type="text/javascript">
<!--    
doQueryAction();
//-->
</script>
	
	
</body>
</html>